import axios from 'axios'
import NProgress from 'nprogress'

export function request (config) {
  const instance = axios.create({
    baseURL: 'https://ku.qingnian8.com/dataApi/qingKu',
    timeout: 5000
  })
  // 添加请求拦截器
  instance.interceptors.request.use((config) => {
    NProgress.start()
    return config
  })
  // 添加响应拦截器
  instance.interceptors.response.use((res) => {
    NProgress.done()
    return res
  })
  return instance(config)
}
